package com.webcamtracker.ui;

import com.webcamtracker.ui.utils.WindowUtilities;

import javax.swing.*;
import java.awt.*;

public class UIImageProcessor extends JFrame {

    private UITrackingImageProcessor uiTrackingImageProcessor;
    private UIVideoMonitor uiVideoMonitor;

    public UIImageProcessor() throws HeadlessException {
        super("Video Processing App");
        configure();
        configureUI();
        init();
    }

    protected void configure() {
        uiTrackingImageProcessor = new UITrackingImageProcessor();
        uiVideoMonitor = new UIVideoMonitor();
        uiVideoMonitor.addVideoSuscriptor(uiTrackingImageProcessor);
    }

    protected void configureUI() {
        Container content = getContentPane();
        content.setBackground(Color.white);
        content.setLayout(new BorderLayout());
        content.add(uiVideoMonitor, BorderLayout.WEST);
        content.add(uiTrackingImageProcessor, BorderLayout.EAST);
    }

    protected void init() {
    }

    public static void main(String[] args) {
        WindowUtilities.setNativeLookAndFeel();
        UIImageProcessor uiImageProcessor = new UIImageProcessor();
        uiImageProcessor.pack();
        uiImageProcessor.setLocationRelativeTo(null);
        uiImageProcessor.setVisible(true);
    }
}
